"use strict";
cc._RF.push(module, '74e46W7kdBGnJDBPBeOs804', 'Champion');
// scripts/Champion.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GlobalUserData"),
    s = t("HallConstant"),
    l = t("BroadCastMessage"),
    c = t("ChannelTool"),
    d = t("HWSdk"),
    h = t("Util"),
    p = t("ScrollViewOptimize"),
    u = t("ChampionManager"),
    f = t("GradeReward"),
    m = cc._decorator,
    _ = m.ccclass,
    y = m.property,
    g = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.pro_bar = null, e.label_pro = null, e.pfb_reward = null, e.rewardList = [], e.scrollView = null, e.pfb_privilege = null, e.lvl = u.GradeLevel.bronzeGrade, e.canCallback = !1, e;
  }

  return n(e, t), e.prototype.onEnable = function () {
    if (h.Util.event_dispatcher.register(this), this.canCallback = !0, h.Util.hideNativeBanner(), h.Util.hideHallBanner(), h.Util.hideBanner(), h.Util.hideNativeGridAd(), h.Util.hideSingleCustomAd(), c.ChannelTool.curentChannel == c.ChannelTool.ChannelEnum.HW ? d["default"].Ins.showNativeInsertAd() : h.Util.showInterstitialAd(null, this.closeMatrixAdCB.bind(this), function () {
      h.Util.show_matrixAd();
    }), this.pro_bar.progress = 1.6 * r["default"].nTrophy / 4e3, this.label_pro.string = r["default"].nTrophy.toString(), 0 == this.rewardList.length) for (var t = 0; t < u["default"].Ins.gradeRewardList.length; t++) {
      var e = cc.instantiate(this.pfb_reward);
      this.pro_bar.node.addChild(e), e.x = u["default"].Ins.gradeRewardList[t].trophy / 2500 * 4e3, this.rewardList.push(e.getComponent(f["default"])), this.refreshGiftStatus(e.getComponent(f["default"]), u["default"].Ins.gradeRewardList[t]);
    } else for (t = 0; t < this.rewardList.length; t++) {
      var o = this.rewardList[t];
      this.refreshGiftStatus(o, u["default"].Ins.gradeRewardList[t]);
    }
  }, e.prototype.closeMatrixAdCB = function () {
    this.canCallback && h.Util.showRightSingleCustomAd();
  }, e.prototype.onDisable = function () {
    this.canCallback = !1, h.Util.hideRightSingleCustomAd(), h.Util.hide_matrixAd(), d["default"].Ins.hideNativeInsertAd(), h.Util.event_dispatcher.remove(this);
  }, e.prototype.refreshGiftStatus = function (t, e) {
    var o = this.lvl != u["default"].Ins.getGradeLevel(e.trophy);
    o && (this.lvl = u["default"].Ins.getGradeLevel(e.trophy)), t.refreshData(e, o);
  }, e.prototype.onBtnClickClose = function () {
    l["default"].getInstance().SendMessage(s.Broadcast_Func.Audio, s.Audio_ID.btn_click), this.node.destroy(), h.Util.is_qg() && !r["default"].isIllustratedBookView && h.Util.showHallBanner(), h.Util.is_VIVO() && r["default"].isIllustratedBookView, h.Util.hideBanner(), r["default"].bAuditMode || r["default"].isIllustratedBookView ? h.Util.hideNativeGridAd() : h.Util.is_VIVO() && !r["default"].bAuditMode && h.Util.showNativeGridAd();
  }, e.prototype.onBtnPrivilege = function () {
    h.Util.hideRightSingleCustomAd();
    var t = cc.instantiate(this.pfb_privilege);
    this.node.addChild(t);
  }, a([y(cc.ProgressBar)], e.prototype, "pro_bar", void 0), a([y(cc.Label)], e.prototype, "label_pro", void 0), a([y(cc.Prefab)], e.prototype, "pfb_reward", void 0), a([y(p["default"])], e.prototype, "scrollView", void 0), a([y(cc.Prefab)], e.prototype, "pfb_privilege", void 0), a([_], e);
}(cc.Component);

o["default"] = g;

cc._RF.pop();